package main

import "fmt"

func main() {
	user1 := make(map[string]string)
	user1["name"] = "小王"
	user1["age"] = "18"
	user1["sex"] = "男"
	user1["addr"] = "湖北"

	user2 := make(map[string]string)
	user2["name"] = "小成"
	user2["age"] = "19"
	user2["sex"] = "女"
	user2["addr"] = "湖南"

	user3 := map[string]string{"name": "小贝", "age": "27", "sex": "女", "addr": "北京"}

	//切片定义 []type，长度，容量
	slice1 := make([]map[string]string, 0, 3)
	slice1 = append(slice1, user1)
	slice1 = append(slice1, user2)
	slice1 = append(slice1, user3)

	//for i := 0; i < len(slice1); i++ {
	//	fmt.Println(slice1[i])
	//}

	for _, v := range slice1 {
		fmt.Printf("name:%s\n", v["name"])
		fmt.Printf("age:%s\n", v["age"])
		fmt.Printf("sex:%s\n", v["sex"])
		fmt.Printf("addr:%s\n", v["addr"])
	}
}
